<?php

declare(strict_types=1);

namespace App\Controller\Api;

use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;
use App\Controller\AbstractController;
use Service\CommodityService\CommodityStockSkillService;

/**
 * @Controller(prefix="/CommodityStock")
 * @author 云仓商品库存服务
 * 特殊场景服务
 */
class CommodityStockController extends AbstractController
{
    /**
     * 查询库存服务商品列表功能
     * @RequestMapping(path="queryStockList", methods="post")
     * @return string[]
     */
    public function queryStockList(RequestInterface $request,CommodityStockSkillService $CommodityStockSkillService)
    {
        return $CommodityStockSkillService->queryStockList($request->getParsedBody());
    }
    
    /**
     * 库存扣减服务功能
     * @RequestMapping(path="reduce", methods="post")
     * @return string[]
     */
    public function reduce(RequestInterface $request,CommodityStockSkillService $CommodityStockSkillService)
    {
        return $CommodityStockSkillService->reduce($request->getParsedBody());
    }
    
    /**
     * 库存增加服务功能
     * @RequestMapping(path="recoverStock", methods="post")
     * @return string[]
     */
    public function recoverStock(RequestInterface $request,CommodityStockSkillService $CommodityStockSkillService)
    {
        return $CommodityStockSkillService->recoverRedisAndMysqlStock($request->getParsedBody());
    }
    
    /**
     * 库存调整数据
     * @RequestMapping(path="initStock", methods="post")
     * @return string[]
     */
    public function initStock(RequestInterface $request,CommodityStockSkillService $CommodityStockSkillService)
    {
        return $CommodityStockSkillService->initStock($request->getParsedBody());
    }
    
    /**
     * 库存上架接口
     * @RequestMapping(path="stockUp", methods="post")
     * @return string[]
     */
    public function stockUp(RequestInterface $request,CommodityStockSkillService $CommodityStockSkillService)
    {
        return $CommodityStockSkillService->stockUp($request->getParsedBody());
    }
}